﻿package com.shawnblais.utils
{
    import com.gskinner.motion.*;
    import fl.motion.easing.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;

    public class ColorTween extends EventDispatcher
    {
        protected var _startColor:Number;
        public var startTransform:ColorTransform;
        protected var _tweenObject:Object;
        protected var _endColor:Number;
        protected var _target:MovieClip;
        public var endTransform:ColorTransform;
        protected var _duration:Number;

        public function ColorTween(mcolor:MovieClip, scolor:Number, ecolor:Number, color:Number = 0.35) : void
        {
            this._startColor = scolor;
            this._endColor = ecolor;
            this._target = mcolor;
            this._duration = color;
            this.startTransform = new ColorTransform();
            this.endTransform = new ColorTransform();
            this.startTransform.color = this._startColor;
            this.endTransform.color = this._endColor;
            this._tweenObject = {prop:0};
            var _loc_5:* = new GTween(this._tweenObject, color, {prop:1}, {ease:Cubic.easeOut});
            _loc_5.addEventListener(Event.CHANGE, this.tweenTransform);
            return;
        }// end function

        protected function tweenTransform(event:Event) : void
        {
            this._target.transform.colorTransform = this.interpolateColor(this.startTransform, this.endTransform, this._tweenObject.prop);
            return;
        }// end function

        protected function interpolateColor(startColor:ColorTransform, startColor:ColorTransform, startColor:Number) : ColorTransform
        {
            var _loc_4:* = new ColorTransform();
            
            return _loc_4;
        }// end function

    }
}
